Skip to content

录制控制 - InputRecord

函数简介

键鼠录制:开始 / 停止自动落盘 / 可选另存为。推荐流程与常见宏录制一致:START → 操作 → STOP(自动落盘),不必再 SAVE

路径请传 ""(空字符串),不要传 NULL。相对路径相对 WorkPath。需要 InputSync 权限。

接口名称

InputRecord

DLL调用

c
int InputRecord(long instance, int action, string path);

参数说明

参数名类型说明
instance长整数型OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。
action整数型0=STOP,1=START,2=SAVE(另存为)。
path字符串START:"" 自动命名到 {WorkPath}/input_rec/ola_input_*.jsonl,或自定义相对/绝对路径;STOP:传 "";SAVE:目标路径(必填)。

示例

SDK 调用

cpp
#include "OLAPlugServer.h"

OLAPlugServer ola;
ola.EnableInputSync(1);
ola.InputRecord(1, "");   // START
ola.MoveTo(300, 400);
ola.MoveR(10, -5);
ola.KeyDown('A');
ola.KeyUp('A');
ola.InputRecord(0, "");   // STOP 自动落盘
csharp
using OLAPlug;

var ola = new OLAPlugServer();
ola.EnableInputSync(1);
ola.InputRecord(1, "");
ola.MoveTo(300, 400);
ola.InputRecord(0, "");
python
from OLAPlugServer import OLAPlugServer

ola = OLAPlugServer()
ola.EnableInputSync(1)
ola.InputRecord(1, "")
ola.MoveTo(300, 400)
ola.InputRecord(0, "")
java
import com.olaplug.OLAPlugServer;

OLAPlugServer ola = new OLAPlugServer();
ola.EnableInputSync(1);
ola.InputRecord(1, "");
ola.MoveTo(300, 400);
ola.InputRecord(0, "");
go
import "github.com/ola/olaplug/olaplug"

ola, _ := olaplug.NewOLAPlugServer("OLAPlug_x64.dll")
defer ola.ReleaseObj()
ola.EnableInputSync(1)
ola.InputRecord(1, "")
ola.MoveTo(300, 400)
ola.InputRecord(0, "")
rust
use olaplug::OLAPlugServer;

let ola = OLAPlugServer::new("OLAPlug_x64.dll").unwrap();
ola.enable_input_sync(1);
ola.input_record(1, "");
ola.move_to(300, 400);
ola.input_record(0, "");
cpp
var ola = com("OlaPlug.OlaSoft")
ola.EnableInputSync(1);
ola.InputRecord(1, "");
ola.MoveTo(300, 400);
ola.InputRecord(0, "");
vbscript
Set ola = CreateObject("OlaPlug.OlaSoft")
ola.EnableInputSync(1)
ola.InputRecord(1, "")
ola.MoveTo(300, 400)
ola.InputRecord(0, "")
text
.局部变量 ola, OLAPlug
ola.创建 ()
ola.EnableInputSync(1)
ola.InputRecord(1, "")
ola.MoveTo(300, 400)
ola.InputRecord(0, "")
aardio
import OLAPlugServer;
var ola = OLAPlugServer();
ola.EnableInputSync(1);
ola.InputRecord(1, "");
ola.MoveTo(300, 400);
ola.InputRecord(0, "");
text
变量 ola <类型 = OLAPlugServer>
ola = 新建 OLAPlugServer
ola.EnableInputSync(1);
ola.InputRecord(1, "");
ola.MoveTo(300, 400);
ola.InputRecord(0, "");
cpp
#include "OLAPlugServer.h"

OLAPlugServer ola;
ola.EnableInputSync(1);
ola.InputRecord(1, "");
ola.MoveTo(300, 400);
ola.InputRecord(0, "");

原生 DLL 调用

cpp
long instance = CreateCOLAPlugInterFace();
EnableInputSync(instance, 1);
InputRecord(instance, 1, "");
// ... MoveTo / KeyDown ...
InputRecord(instance, 0, "");
csharp
using System.Runtime.InteropServices;

[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern long CreateCOLAPlugInterFace();
[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern int EnableInputSync(long instance, int enable);
[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern int InputRecord(long instance, int action, string path);

long instance = CreateCOLAPlugInterFace();
EnableInputSync(instance, 1);
InputRecord(instance, 1, "");
InputRecord(instance, 0, "");
python
from ctypes import CDLL, c_int64

ola = CDLL("OLAPlug_x64.dll")
ola.CreateCOLAPlugInterFace.restype = c_int64
instance = ola.CreateCOLAPlugInterFace()
ola.EnableInputSync(instance, 1)
ola.InputRecord(instance, 1, b"")
ola.InputRecord(instance, 0, b"")

返回值

返回值说明
1成功。
0失败(无权限、路径无效、未 START 就 STOP/SAVE 等)。

相关接口